import { ref } from 'vue'
import { defineStore } from 'pinia'

import { cateList } from '@/api/index'

interface ICate {
  id:number
  cate:string
  cate_name:string
  cate_url?: string
}
export const useCateStore = defineStore('cate', () => {
  const cates = ref<ICate []>([])
  const cateListFn = async ()=> {
      await cateList().then(
         (resData:any)=>{
            // console.log(resData)
            if(resData.code == 200) {
              cates.value = resData.result
            }
         }
      )
  }
  return { cates, cateListFn}
})
